package student

import (
	"XSSS_v2/handler"
	"XSSS_v2/model"
	"XSSS_v2/pkg/errno"
	"github.com/gin-gonic/gin"
	"strconv"
)

// DeleteStu
// @Tags admin
// @Summary 根据id删除一个学生
// @Description Delete a student by ID
// @Param id path uint64 true "The student's database sno"
// @Success 200 {object} handler.Response
// @Router /v1/admin/{id} [delete]
func DeleteStu(c *gin.Context) {
	//参数从Path中获取
	stuId, _ := strconv.Atoi(c.Param("id"))
	err := model.DeleteStu(stuId)
	if err != nil {
		handler.SendResponse(c, errno.ErrDatabase, nil)
		return
	}
	handler.SendResponse(c, nil, nil)
}
